package cn.dakaqi.entities;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by chunyang on 2016/4/18.
 * 福利券码
 */
@Cacheable
@Entity
@Table(name = "U_WELFARE_ITEM")
public class WelfareItem extends IdEntity
{
    private Welfare welfare; //福利编号
    private String code;//福利项目编号
    private Date createTime;//创建时间
    private String memberCode;//兑换人
    private int isChanage;//是否已兑换
    private int isUse;//是否已使用
    private Date useTime;//使用时间

    public WelfareItem(String code, Welfare welfare)
    {
        this.code = code;
        this.welfare = welfare;
    }

    public WelfareItem()
    {
    }

    public WelfareItem(Long id)
    {
        this.id = id;
    }

    public String getMemberCode()
    {
        return memberCode;
    }

    public void setMemberCode(String memberCode)
    {
        this.memberCode = memberCode;
    }

    @ManyToOne
    @JoinColumn(name = "WELFARE_ID")
    @JsonIgnore
    public Welfare getWelfare()
    {
        return welfare;
    }

    public void setWelfare(Welfare welfare)
    {
        this.welfare = welfare;
    }

    public String getCode()
    {
        return code;
    }

    public void setCode(String code)
    {
        this.code = code;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+08:00")
    public Date getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }

    public int getIsChanage()
    {
        return isChanage;
    }

    public void setIsChanage(int isChanage)
    {
        this.isChanage = isChanage;
    }

    public int getIsUse()
    {
        return isUse;
    }

    public void setIsUse(int isUse)
    {
        this.isUse = isUse;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+08:00")
    public Date getUseTime()
    {
        return useTime;
    }

    public void setUseTime(Date useTime)
    {
        this.useTime = useTime;
    }
}
